Back


Goal 3: Good health and well-being

Abortions


GS Age standardized rate for woman aged 12-49 years
# Helper function:
age_adjust <- function(count, pop, rate = NULL, stdpop){
  if (missing(count) & !missing(pop) & is.null(rate)) {
    count <- rate * pop
  }
  
  if (missing(pop) & !missing(count) & is.null(rate)) {
    pop <- count/rate
    pop[!is.finite(pop)] <- 0
  }
  
  if (is.null(rate) & !missing(count) & !missing(pop)){
    rate <- count/pop
    rate[!is.finite(rate)] <- 0
  }

  cruderate <- sum(count)/sum(pop)
  stdwt <- stdpop/sum(stdpop)
  dsr <- sum(stdwt * rate)
  
  tibble(`crude_rate` = cruderate, `std_rate` = dsr)
}

# Import
SUDA2_raw <- 
  statgl_url("SUXA2", lang = "da") |>  
  statgl_fetch(.eliminate_rest = FALSE) |> 
  as_tibble() |> 
    rename(Aborter = value)

# Tidy
SUDA_2 <- 
  SUDA2_raw |> 
  as_tibble() |>  
  spread(enhed, Aborter) |> 
  mutate_at(c(1, 2), strtoi)

# Standardize
SUDA_2_2000 <- SUDA_2 |>  filter(tid == 2000) |>  pull(Middelfolketal)

SUDA2_std <- 
  SUDA_2 |> 
  group_by(tid) |>  
  summarise(age_adjust(Aborter, Middelfolketal, stdpop = SUDA_2_2000) * 1000)

# Plot
SUDA2_std |> 
  ggplot(aes(x = tid, y = std_rate)) +
  geom_line(size = 2, color = statgl:::statgl_cols("darkblue"))+
  theme_statgl() +
  theme(plot.margin = margin(10, 10, 10, 10)) +
  labs(
    title    = sdg3$figs$fig1$title[language], 
    x        = " ", 
    y        = sdg3$figs$fig1$y_lab[language], 
    subtitle = sdg3$figs$fig1$sub[language],
    caption  = sdg3$figs$fig1$cap[language]
    )

StatBank


# Helper function:
age_adjust <- function(count, pop, rate = NULL, stdpop){
  if (missing(count) & !missing(pop) & is.null(rate)) {
    count <- rate * pop
  }
  
  if (missing(pop) & !missing(count) & is.null(rate)) {
    pop <- count/rate
    pop[!is.finite(pop)] <- 0
  }
  
  if (is.null(rate) & !missing(count) & !missing(pop)){
    rate <- count/pop
    rate[!is.finite(rate)] <- 0
  }

  
  cruderate <- sum(count)/sum(pop)
  stdwt <- stdpop/sum(stdpop)
  dsr <- sum(stdwt * rate)
  
  tibble(`crude_rate` = cruderate, `std_rate` = dsr)
}

# Import
SUDA2_raw <- 
  statgl_url("SUXA2", lang = "da") |>  
  statgl_fetch(.eliminate_rest = FALSE) |> 
  as_tibble() |> 
  rename(Aborter = value)

# Tidy
SUDA_2 <- 
  SUDA2_raw |> 
  as_tibble() |>  
  spread(enhed, Aborter) |>  
  mutate_at(c(1, 2), strtoi)

# Standardize
SUDA_2_2000 <- SUDA_2 |>  filter(tid == 2000) |>  pull(Middelfolketal)

SUDA2_std <- 
  SUDA_2 |> 
  group_by(tid) |>  
  summarise(age_adjust(Aborter, Middelfolketal, stdpop = SUDA_2_2000) * 1000,
            Aborter = sum(Aborter), Middelfolketal = sum(Middelfolketal))


vec        <- 2:5
names(vec) <- c(
    sdg3$figs$fig1$cols$col2[language],
    sdg3$figs$fig1$cols$col3[language],
    sdg3$figs$fig1$cols$col4[language],
    sdg3$figs$fig1$cols$col5[language]
    )

# Table
SUDA2_std |> 
  #arrange(desc(tid)) %>% 
  filter(tid > year(Sys.time()) - 7) |> 
  rename(vec) |> 
  gather(key, value, -tid) |>  
  mutate(
    key   = key |>  fct_inorder(),
    value = value |>  round(1),
    tid   = tid |>  factor(levels = unique(tid))
    ) |> 
  spread(1, 3) |>  
  rename(" " = 1) |>  
  statgl_table()
2018 2019 2020 2021 2022
Abortions per 1000 66,4 64,7 63,7 60,0 61,7
Age standardized rate per 1000 woman aged 12-49 years 57,9 56,2 55,8 52,8 54,5
Abortions 931,0 902,0 889,0 842,0 870,0
Middle population 14.019,0 13.941,0 13.953,0 14.029,0 14.097,0
Last update: 12. april 2024

Life expectancy


GS Life expectancy for 0- and 1-year-old born in Greenland
# Import
BEXBBDTB_raw <- 
  "BEXBBDTB" |>  
  statgl_url(lang = "da") |>  
  statgl_fetch(
    "place of birth" = "N",
    gender           = "t",
    age              = 0:1,
    calcbase         = "q5",
    measure          = "ex",
    time             = px_all(),
    .col_code        = TRUE
  ) |> 
  as_tibble()

# Plot
BEXBBDTB_raw |> 
  ggplot(aes(
    x     = as.numeric(time),
    y     = value,
    color = age
  )) +
  geom_line(size = 2) +
  theme_statgl() +
  scale_color_statgl() +
  scale_y_continuous(labels = scales::unit_format(
    suffix       = " ",
    big.mark     = ".",
    decimal.mark = ","
    )) +
  labs(
    title    = sdg3$figs$fig2$title[language],
    subtitle = sdg3$figs$fig2$sub[language],
    x        = " ",
    y        = BEXBBDTB_raw[["measure"]][[1]],
    color    = sdg3$figs$fig2$color[language],
    caption  = sdg3$figs$fig2$cap[language]
  )

StatBank

Method


# Transform
tab <- 
  BEXBBDTB_raw |> 
  select(age, time, measure, calcbase, value) |>  
  unite(combi, measure, calcbase, sep = ", ") |>  
  filter(time >= max(as.numeric(time)) - 9) |> 
  spread(time, value)

# Table
tab |> 
  select(-combi) |> 
  rename(" " = 1) |>  
  statgl_table() |> 
  pack_rows(index = tab[["combi"]] |>  table())
2013 2014 2015 2016 2017 2018 2019 2020 2021 2022
Middellevetid, 5 år
0 70,1 70,2 70,7 71,1 71,1 71,2 71,2 71,1 71,1 71,1
1 69,3 69,5 70,0 70,4 70,4 70,5 70,4 70,4 70,4 70,5

Mortality


GS Age-standardized mortality rate
# Helper function:
age_adjust <- function(count, pop, rate = NULL, stdpop){
  if (missing(count) & !missing(pop) & is.null(rate)) {
    count <- rate * pop
  }
  
  if (missing(pop) & !missing(count) & is.null(rate)) {
    pop <- count/rate
    pop[!is.finite(pop)] <- 0
  }
  
  if (is.null(rate) & !missing(count) & !missing(pop)){
    rate <- count/pop
    rate[!is.finite(rate)] <- 0
  }

 
  cruderate <- sum(count)/sum(pop)
  stdwt <- stdpop/sum(stdpop)
  dsr <- sum(stdwt * rate)
  
  tibble(`crude_rate` = cruderate, `std_rate` = dsr)
}

# Import
BEDBBDM1_raw <-
  statgl_url("BEXBBDM1", lang = "da") |>  
  statgl_fetch(
    type      = px_all(),
    age       = px_all(),
    .col_code = TRUE) |> 
  as_tibble() |> 
    rename(c(
      "alder"    = 1,
      "art"      = 2,
      "tid"      = 3,
      "Dødsfald" = 4
      ))

BEDBBM1 <- 
  BEDBBDM1_raw |>  
  as_tibble() |>  
  spread(art, Dødsfald) |>  
  mutate_at(1:2, strtoi) 

BEDBBM1_2000 <- 
  BEDBBM1 |>  
  filter(tid == 2000) |>  
  pull(Middelfolketal)

BEDBBM1_std <- BEDBBM1 |> 
  group_by(tid) |> 
  summarise(age_adjust(Døde, Middelfolketal, stdpop = BEDBBM1_2000) * 1000) |> 
  ungroup()

BEDBBM1_std |> 
  ggplot(aes(
    x = tid, 
    y = std_rate
    )) +
  geom_line(size = 2, color = statgl:::statgl_cols("darkblue")) +
  theme_statgl() +
  labs(
    title    = sdg3$figs$fig4$title[language],
    subtitle = sdg3$figs$fig4$sub[language],
    y        = sdg3$figs$fig4$y_lab[language],
    x        = " ",
    caption  = sdg3$figs$fig4$cap[language]
  )

StatBank

Method


# Helper function:
age_adjust <- function(count, pop, rate = NULL, stdpop){
  if (missing(count) & !missing(pop) & is.null(rate)) {
    count <- rate * pop
  }
  
  if (missing(pop) & !missing(count) & is.null(rate)) {
    pop <- count/rate
    pop[!is.finite(pop)] <- 0
  }
  
  if (is.null(rate) & !missing(count) & !missing(pop)){
    rate <- count/pop
    rate[!is.finite(rate)] <- 0
  }

  cruderate <- sum(count)/sum(pop)
  stdwt <- stdpop/sum(stdpop)
  dsr <- sum(stdwt * rate)
  
  tibble(`crude_rate` = cruderate, `std_rate` = dsr)
}

# Import
BEDBBDM1_raw <-
  statgl_url("BEXBBDM1", lang = "da") |> 
  statgl_fetch(
    type      = px_all(),
    age       = px_all(),
    .col_code = TRUE) |> 
  as_tibble() |> 
    rename(c(
      "alder"    = 1,
      "art"      = 2,
      "tid"      = 3,
      "Dødsfald" = 4
      ))

BEDBBM1 <- 
  BEDBBDM1_raw |>  
  as_tibble() |>  
  spread(art, Dødsfald) |>  
  mutate_at(1:2, strtoi) 

BEDBBM1_2000 <- 
  BEDBBM1 |>  
  filter(tid == 2000) |>  
  pull(Middelfolketal)

BEDBBM1_std <- BEDBBM1 |> 
  group_by(tid) |> 
  summarise(age_adjust(Døde, Middelfolketal, stdpop = BEDBBM1_2000) * 1000) |> 
  ungroup()

vec <- 2:3
names(vec) <- c(
  sdg3$figs$fig4$cols$col2[language], 
  sdg3$figs$fig4$cols$col3[language]
  )

BEDBBM1_std |> 
  arrange(desc(tid)) |>  
  filter(tid > year(Sys.time()) - 7) |>  
  rename(vec) |> 
  gather(key, value, -tid) |>  
  mutate(
    tid   = tid |>  factor(levels = unique(tid)), 
    value = value |>  round(3)
    ) |> 
  spread(1, 3) |>  
  rename(" " = 1) |>  
  statgl_table()
2023 2022 2021 2020 2019 2018
Crude Rate 9,43 9,28 9,40 9,27 9,78 8,71
Std. Rate 5,38 5,60 5,79 5,70 6,07 5,43
# Helper function:
age_adjust <- function(count, pop, rate = NULL, stdpop){
  if (missing(count) & !missing(pop) & is.null(rate)) {
    count <- rate * pop
  }
  
  if (missing(pop) & !missing(count) & is.null(rate)) {
    pop <- count/rate
    pop[!is.finite(pop)] <- 0
  }
  
  if (is.null(rate) & !missing(count) & !missing(pop)){
    rate <- count/pop
    rate[!is.finite(rate)] <- 0
  }

  
  cruderate <- sum(count)/sum(pop)
  stdwt <- stdpop/sum(stdpop)
  dsr <- sum(stdwt * rate)
  
  tibble(`crude_rate` = cruderate, `std_rate` = dsr)
}

# Import
BEDBBDM1_raw <-
  statgl_url("BEXBBDM1", lang = language) |> 
  statgl_fetch(
    type      = px_all(),
    age       = px_all(),
    gender    = c("M", "K"),
    .col_code = TRUE) |> 
  as_tibble()

BEDBBDM1 <- 
  BEDBBDM1_raw |>  
  as_tibble() |>  
  spread(type, value) |>  
  mutate_at(c(1, 3), strtoi) |> 
  rename(c("Death" = 4, "Meanpopulation" = 5))

BEDBBDM1_2000 <- 
  BEDBBDM1 |>  
  arrange(time, gender, age) |>  
  filter(time == 2000) |>  
  pull(Meanpopulation)

BEDBBDM1_std <- 
  BEDBBDM1 |>  
  group_by(time, gender) |>  
  arrange(age) |>  
  summarise(age_adjust(Death, Meanpopulation, stdpop = BEDBBDM1_2000) * 1000) |>  
  ungroup()

BEDBBDM1_std |> 
  ggplot(aes(
    x     = time, 
    y     = std_rate, 
    color = gender
  )) +
  geom_line(size = 2) + 
  theme_statgl() +
  scale_color_statgl(reverse = TRUE) +
  labs(
    title    = sdg3$figs$fig5$title[language], 
    subtitle = sdg3$figs$fig5$sub[language],
    color    = " ", 
    x        = " ",
    y        = sdg3$figs$fig5$y_lab[language],
    caption  = sdg3$figs$fig4$cap[language]
  )

StatBank

Method


# Helper function:
age_adjust <- function(count, pop, rate = NULL, stdpop){
  if (missing(count) & !missing(pop) & is.null(rate)) {
    count <- rate * pop
  }
  
  if (missing(pop) & !missing(count) & is.null(rate)) {
    pop <- count/rate
    pop[!is.finite(pop)] <- 0
  }
  
  if (is.null(rate) & !missing(count) & !missing(pop)){
    rate <- count/pop
    rate[!is.finite(rate)] <- 0
  }

  cruderate <- sum(count)/sum(pop)
  stdwt <- stdpop/sum(stdpop)
  dsr <- sum(stdwt * rate)
  
  tibble(`crude_rate` = cruderate, `std_rate` = dsr)
}

# Import
BEDBBDM1_raw <-
  statgl_url("BEXBBDM1", lang = language) |> 
  statgl_fetch(
    type      = px_all(),
    age       = px_all(),
    gender    = c("M", "K"),
    .col_code = TRUE) |> 
  as_tibble()

BEDBBDM1 <- 
  BEDBBDM1_raw |>  
  spread(type, value) |>  
  mutate_at(c(1, 3), strtoi) |> 
  rename(c("Death" = 4, "Meanpopulation" = 5))

BEDBBDM1_2000 <- 
  BEDBBDM1 |>  
  arrange(time, gender, age) |>  
  filter(time == 2000) |>  
  pull(Meanpopulation)

BEDBBDM1_std <- 
  BEDBBDM1 |>  
  group_by(time, gender) |>  
  arrange(age) |> 
  summarise(age_adjust(Death, Meanpopulation, stdpop = BEDBBDM1_2000) * 1000) |> 
  ungroup()

vec        <- 2:3
names(vec) <- 
  c(
    sdg3$figs$fig4$cols$col2[language], 
    sdg3$figs$fig4$cols$col3[language]
    )

step <- 
  BEDBBDM1_std |> 
  filter(time > year(Sys.time()) - 5) |>  
  unite(combi, 1, 2, sep = ",") |> 
  rename(vec) |> 
  gather(key, value, -combi) |>  
  mutate(
    combi = combi |>  fct_inorder(),
    key   = key |>  fct_inorder(),
    value = value |>  round(3)
  ) |> 
  spread(1, 3)

vecvec   <- step[-1] |>  colnames() |>  str_split(",") |>  unlist()
head_vec <- vecvec[c(T, F)] |>  table()
col_vec  <- vecvec[c(F, T)]

step |> 
  rename(" " = 1) |>  
  statgl_table(
    col.names = c(" ", col_vec)
    ) |> 
  add_header_above(c(" ", head_vec))
2020
2021
2022
2023
2020,Men 2020,Women 2021,Men 2021,Women 2022,Men 2022,Women 2023,Men 2023,Women
Crude Rate 10,02 8,42 10,01 8,72 10,5 7,96 11,30 7,33
Std. Rate 6,35 5,04 6,42 5,05 6,5 4,55 6,74 3,89



Tuberculosis


FN 3.3.2 New tuberculosis cases per 100,000 inhabitants
# Import
DISE01_raw <- 
  "https://pxweb.nhwstat.org:443/Prod/sq/31c3d851-c0ad-4728-8ee0-9b2b252cc48b.csv" |> 
  read_csv() |> 
  as_tibble()

# Transform
DISE01 <- 
  DISE01_raw |> 
  pivot_longer(cols = c(`Greenland Men`, `Greenland Women`), names_to = "sex", values_to = "Greenland") |> 
  mutate(
    sex  = sex |>  str_replace("Greenland Men",   sdg3$figs$fig6$groups$group1[language] |>  unlist()),
    sex  = sex |>  str_replace("Greenland Women", sdg3$figs$fig6$groups$group2[language] |>  unlist()),
    Greenland = as.numeric(Greenland)
  ) |> 
  filter(Year > 2002)

# Plot
DISE01 |> 
  ggplot(aes(
    x     = Year,
    y     = Greenland,
    color = sex
  )) +
  geom_line(size = 2) +
  theme_statgl() +
  scale_color_statgl(reverse = TRUE) +
  labs(
    title    = sdg3$figs$fig6$title[language],
    subtitle = sdg3$figs$fig6$sub[language],
    x        = " ",
    y        = sdg3$figs$fig6$y_lab[language],
    color    = " ",
    caption  = sdg3$figs$fig6$cap[language]
  )

Table, NOMESCO


# Transform
DISE01 <- 
  DISE01_raw |> 
  pivot_longer(cols = c(`Greenland Men`, `Greenland Women`), names_to = "sex", values_to = "Greenland") |> 
  mutate(
    sex  = sex |>  str_replace("Greenland Men",   sdg3$figs$fig6$groups$group1[language] |>  unlist()),
    sex  = sex |>  str_replace("Greenland Women", sdg3$figs$fig6$groups$group2[language] |>  unlist())
  ) |> 
  filter(Year >= year(Sys.time()) - 7) |> 
  select(-`Greenland Men and Women`) |> 
  spread(1,3)

# Table
DISE01 |> 
  rename(" " = 1) |> 
  statgl_table() |> 
  pack_rows(index = rep(sdg3$figs$fig6$index[language] |>  unlist(), length(DISE01[[1]])) |>  table()) |>  
  add_footnote(
    sdg3$figs$fig6$foot[language], 
    notation = "symbol"
  )
2017 2018 2019 2020 2021 2022
Diagnosed cases of tuberculosis
Men 132.5 119.5 187.3 .. .. ..
Women 91.8 96.3 86.5 .. .. ..
* per hundred thousand people

Suicide


FN 3.4.3 Suicide rate
# Import
SUDLDM2_raw <- 
  read_csv(paste0("https://bank.stat.gl:443/sq/3efbaaab-3db0-4b90-8f7b-18c556afe4e4", "?lang=", language),
    locale = locale(encoding = "latin1"))

BEDSTM1_raw <- 
  read_csv(paste0("https://bank.stat.gl:443/sq/e8c2ed7c-ed03-471b-87e1-40d658b78bd4", "?lang=", language))

# Transform
Selvmord <-
  SUDLDM2_raw |> 
  left_join(BEDSTM1_raw) |>  
  rename(
    "cause"      = 1,
    "time"       = 2,
    "suicide"    = 3,
    "population" = 4
    ) |> 
  mutate(rate = suicide / population * 10^5,
         time = time |>  make_date()) |> 
  filter(rate > 0)

# Plot
Selvmord |> 
  ggplot(aes(
    x = time,
    y = rate,
    color = statgl:::statgl_cols("darkblue")
  )) +
  geom_line(size = 2) +
  theme_statgl() + scale_color_statgl() +
  theme(legend.position = "none") +
  labs(
    title   = Selvmord[[1]][1],
    x       = " ",
    y       = sdg3$figs$fig7$y_lab[language],
    caption = sdg3$figs$fig7$cap[language]
  )

StatBank


# Transform
Selvmord <-
  SUDLDM2_raw |> 
  left_join(BEDSTM1_raw) |>  
  rename(
    "cause"      = 1,
    "time"       = 2,
    "suicide"    = 3,
    "population" = 4
    ) |> 
  mutate(rate = (suicide / population * 10^5) |>  round(2)) |>  
  #arrange(desc(time)) %>% 
  filter(rate > 0, 
         time >= year(Sys.time()) - 7) |> 
  select(-(3:4)) |> 
  mutate(time = time |>  factor(levels = unique(time))) |>  
  spread(2, 3)

# Table
Selvmord |> 
  rename(" " = 1) |>  
  statgl_table() |> 
  add_footnote(
    sdg3$figs$fig7$foot[language], 
    notation = "symbol"
    )
2017 2018 2019 2020 2021 2022
Suicide and attempted suicide 69,8 80,5 80,4 73,1 83,3 72,5
* per hundred thousand people

Child mortality


FN 3.2.1 Mortality for children younger than five years
# Import, dødelighed
BEXBBDM1_raw <-
  statgl_url("BEXBBDM1", lang = language) |> 
  statgl_fetch(
    age       = 0:4,
    type      = "D",
    .col_code = TRUE
    ) |> 
  as_tibble()

# Import, levendefødte
BEXBBLK1_raw <-
  statgl_url("BEXBBLK1", lang = language) |> 
  statgl_fetch(
    type      = "L",
    .col_code = TRUE
    ) |> 
  as_tibble()

child_mortality <-
  BEXBBDM1_raw |>  
  spread(2, 4) |>  
  spread(1, 3) |>  
  mutate(sum = `0` + `1` + `2` + `3` + `4`) |> 
  select(-(2:6)) |> 
  left_join(BEXBBLK1_raw |>  spread(1, 3)) |>  
  rename(
    "mortality"  = 2,
    "population" = 3
  ) |> 
  mutate(rate = mortality / population * 1000,
         time = time |>  make_date())

# Plot
child_mortality |> 
  ggplot(aes(
    x = time,
    y = rate,
    color = statgl:::statgl_cols("darkblue")
    )) +
  geom_line(size = 2, color = statgl:::statgl_cols("darkblue")) +
  expand_limits(y = 0) +
  theme_statgl() +
  labs(
    title    = sdg3$figs$fig8$title[language],
    subtitle = sdg3$figs$fig8$sub[language],
    x        = " ",
    y        = sdg3$figs$fig8$y_lab[language],
    caption  = sdg3$figs$fig8$cap[language]
  )

StatBank


# Transform
child_mortality <-
  BEXBBDM1_raw |>  
  spread(2, 4) |>  
  spread(1, 3) |>  
  mutate(sum = `0` + `1` + `2` + `3` + `4`) |> 
  select(-(2:6)) |> 
  left_join(BEXBBLK1_raw |>  spread(1, 3)) |>  
  rename(
    "mortality"  = 2,
    "population" = 3
    ) |> 
  mutate(rate = mortality / population * 1000,
         rate = rate %>% round(3)) |>  
  select(-(2:3)) |> 
  #arrange(desc(time)) %>% 
  filter(time >= year(Sys.time()) - 5) |>  
  mutate(time = time |>  factor(levels = unique(time)),
         var = sdg3$figs$fig8$cols$col3[language]) |>  
  spread(1, 2)

# Table
child_mortality |> 
  rename(" " = 1) |>  
  statgl_table() |> 
  add_footnote(
    sdg3$figs$fig8$foot[language], 
    notation = "symbol"
    )
2019 2020 2021 2022 2023
Child mortality 14,1 12 15,8 13,4 12,6
* Mortality rate per thousand live births

Tobacco and alcohol


FN 3.5.2 Supply of alcohol per person above the age of 14
url <- paste0("https://bank.stat.gl:443/api/v1/", language, "/Greenland/AL/AL10/ALXALK1.px")

# Import
ALXALK1_raw <-
  url |> 
  statgl_fetch(
    unit      = 1,
    type      = 0:2,
    category  = 1,
    .col_code = TRUE
    ) |> 
  as_tibble()

# Transform
ALXALK1 <-
  ALXALK1_raw |>  
  mutate(time = time |>  make_date())
  
# Plot
ALXALK1 |> 
  ggplot(aes(
    x    = time,
    y    = value,
    fill = type
    )) +
  geom_area() +
  theme_statgl() +
  scale_fill_statgl(palette = "autumn") +
  labs(
    title    = sdg3$figs$fig9$title[language],
    subtitle = sdg3$figs$fig9$sub[language],
    x        = " ",
    y        = sdg3$figs$fig9$y_lab[language],
    fill     = sdg3$figs$fig9$fill[language],
    caption  = sdg3$figs$fig9$cap[language]
  )

StatBank

Method


# Transform
ALXALK1 <-
  ALXALK1_raw |> 
  #arrange(desc(time)) %>% 
  filter(time >= year(Sys.time()) - 5) |>  
  mutate(time = time |>  factor(levels = unique(time))) |>  
  spread(4, 5)

# Table
ALXALK1 |> 
  select(-c(1, 3)) |>  
  rename(" " = 1) |> 
  statgl_table() |> 
  pack_rows(index = table(ALXALK1[[3]]))
2019 2020 2021 2022 2023
Litres per person over 14 years
Beer 5,54 6,31 6,28 5,86 6,26
Spirits 0,64 0,77 0,86 0,87 0,81
Wine 1,43 1,68 1,65 1,52 1,43
FN 3.a.1 Imports of cigarettes per day per person above the age of 14
url <- paste0("https://bank.stat.gl:443/api/v1/", language, "/Greenland/AL/AL40/ALXTOB2.px")

# Import
ALXTOB2_raw <-
  url |> 
  statgl_fetch(
    unit      = 3,
    type      = 0:1,
    .col_code = TRUE
    ) |> 
  as_tibble()

  
# Transform
ALXTOB2 <-
  ALXTOB2_raw |> 
  mutate(time = time |>  make_date())

# Plot
ALXTOB2 |> 
  ggplot(aes(
    x    = time,
    y    = value,
    fill = type
    )) +
  geom_area() +
  theme_statgl() +
  theme(plot.margin = margin(10, 10, 10, 10)) +
  scale_fill_statgl(palette = "autumn") +
  scale_y_continuous(labels = scales::comma_format(
    decimal.mark = ",", 
    big.mark     = "."
    )) +
  labs(
    title    = sdg3$figs$fig10$title[language],
    subtitle = sdg3$figs$fig10$sub[language],
    x        = " ",
    y        = sdg3$figs$fig10$y_lab[language],
    fill     = sdg3$figs$fig10$fill[language],
    caption  = sdg3$figs$fig10$cap[language]
  )

StatBank

Method


# Transform
ALXTOB2 <-
  ALXTOB2_raw |> 
  #arrange(desc(time)) %>% 
  filter(time >= year(Sys.time()) - 5) |>  
  mutate(time = time |>  factor(levels = unique(time))) |>  
  spread(2, 4)

# Table
ALXTOB2 |> 
  select(-1) |>  
  rename(" " = 1) |>  
  statgl_table() |> 
  pack_rows(index = table(ALXTOB2[[1]]))
2019 2020 2021 2022 2023
Numbers per day per person over 14 years
Regular cigarettes 2,75 3,28 2,82 3,02 3,20
Rolling tobacco 2,91 2,46 2,40 2,13 1,78

Public health workers


FN 3.c.1 Public health workers
# Import
OFXOA1_raw <-
  statgl_url("OFXOA1", lang = language) |> 
  statgl_fetch(
    `inventory variable` = px_all(),
    .col_code            = TRUE
    ) |> 
  as_tibble()

# Transform
OFXOA1 <-
  OFXOA1_raw |>  
  mutate(
    time  = time |>  make_date(),
    value = value * 10^-3
    )

# Plot
OFXOA1 |> 
  ggplot(aes(
    x    = time,
    y    = value,
    fill = `inventory variable`
  )) +
  geom_col(position = "dodge") +
  theme_statgl() + 
  scale_fill_statgl(reverse = TRUE) +
  labs(
    title   = sdg3$figs$fig11$title[language],
    x       = " ",
    y       = sdg3$figs$fig11$y_lab[language],
    fill    = " ",
    caption = sdg3$figs$fig11$cap[language]
  )

StatBank

Method


# Transform
OFXOA1 <- 
  OFXOA1_raw |> 
  #arrange(desc(time)) %>% 
  filter(time >= year(Sys.time()) - 5) |>  
  mutate(time = time |>  factor(levels = unique(time))) |>  
  spread(1, 3)

# Table
OFXOA1 |> 
  rename(" " = 1) |>  
  statgl_table() |> 
  add_footnote(
    sdg3$figs$fig11$foot[language], 
    notation = "symbol"
    )
2019 2020 2021 2022
Employees 18.976 18.691 18.909 18.990
Full-time employees 10.872 11.066 11.279 11.224
* Number of persons in the health care system

Birth weight


GS Birth weight
# Import
BEDLL1_raw <- 
  statgl_url("BEXLL1", lang = language) |>  
  statgl_fetch(
    time      = px_all(),
    weight    = 0:9,
    .col_code = TRUE
  ) |> 
  as_tibble()

# Transform
BEDLL1 <- 
  BEDLL1_raw |>  
  mutate(
    time   = time |>  as.numeric(),
    weight = weight |>  str_remove("gram") |>  trimws(),
    weight = weight |>  factor(levels = unique(weight))
  ) |> 
  filter(time %in% quantile(time)[-1])

# Plot
BEDLL1 |> 
  ggplot(aes(
    x    = weight,
    y    = value,
    fill = time |>  as.factor()
  )) +
  geom_col(position = "dodge2") +
  theme_statgl() + 
  theme(text = element_text(size = 20)) +
  scale_fill_statgl() +
  labs(
    title   = sdg3$figs$fig12$title[language],
    x       = sdg3$figs$fig12$x_lab[language],
    y       = sdg3$figs$fig12$y_lab[language],
    fill    = " ",
    caption = sdg3$figs$fig12$cap[language]
  )

StatBank




# Table
BEDLL1_raw |> 
  mutate(
    time   = time   |>  as.numeric(),
    weight = weight |>  factor(levels = unique(weight))
  ) |> 
  filter(time %in% quantile(time)[-1]) |>  
  arrange(desc(time)) |> 
  mutate(time = time |> factor(levels = unique(time))) |>  
  spread(time, value) |> 
  rename(" " = 1) |> 
  statgl_table() |> 
  add_footnote(sdg3$figs$fig12$foot[language], notation = "symbol")
2010 2005 2000 1995
Under 1000 gram 3 1 3 2
1000-1499 gram 5 1 4 15
1500-1999 gram 15 8 5 7
2000-2499 gram 32 22 15 34
2500-2999 gram 83 119 91 129
3000-3499 gram 293 275 289 340
3500-3999 gram 273 303 294 361
4000-4499 gram 124 118 138 169
4500-4999 gram 31 33 34 36
Over 5000 gram 5 5 2 6
* Number of persons

Intoxicants


GS Intoxicants
# Import 
a <- c(3, 6, 16, 37, 49, 56, 3, 8, 24, 37, 52, 55, 2, 2, 6, 25, 43, 49, 1.5, 2, 6, 15, 26, 52)
b <- rep(c(11, 12, 13, 14, 15, 16), 4)
c <- c(rep(2006, 6), rep(2010, 6), rep(2014, 6), rep(2018, 6))

# Transform
hbsc <-
  data.frame(a, b, c) |> 
  as_tibble() |> 
  rename(
    "value" = 1,
    "age"   = 2,
    "time"  = 3
    ) |> 
  mutate(age = age |>  factor(levels = unique(age)))

# Plot  
hbsc |> 
  ggplot(aes(
    x = age,
    y = value,
    fill = age
  )) +
  geom_col() +
  facet_wrap(~ time) +
  xlab("age") +
  scale_y_continuous(labels  = scales::percent_format(
    scale        = 1,
    big.mark     = ".",
    decimal.mark = ","
  )) +
  theme_statgl() + 
  scale_fill_statgl() +
  theme(legend.position = "none") +
  labs(
    title   = sdg3$figs$fig13$title[language],
    x       = sdg3$figs$fig13$x_lab[language],
    y       = " ",
    caption = sdg3$figs$fig13$cap[language]
  )

HBSC survey


vec        <- 1
names(vec) <-  sdg3$figs$fig13$x_lab[language]
  
# Table
hbsc |> 
  arrange(desc(time)) |>  
  mutate(time = time |>  factor(levels = unique(time))) |>  
  spread(time, value) |>  
  rename(vec) |> 
  statgl_table() |> 
  add_footnote(sdg3$figs$fig13$foot[language], notation = "symbol")
Age 2018 2014 2010 2006
11 1,5 2 3 3
12 2,0 2 8 6
13 6,0 6 24 16
14 15,0 25 37 37
15 26,0 43 52 49
16 52,0 49 55 56
* Daily smoking in % among 11-16 year olds, 2006-2018 (N=2,085 in 2018)
key1 <- sdg3$figs$fig14$keys$key1[language] |>  unlist()
key2 <- sdg3$figs$fig14$keys$key2[language] |>  unlist()
key3 <- sdg3$figs$fig14$keys$key3[language] |>  unlist()


  
# Import
a <- c(6, 3, 4, 2, 3, 2)
b <- rep(c(2014, 2018), 3)
c <- c(rep(key1, 2), rep(key2, 2), rep(key3, 2))

hbsc <- 
  data.frame(b, a, c) |> 
  as_tibble() |> 
  rename(
    "time" = 1,
    "value" = 2,
    "key" = 3
  ) |> 
  mutate(
    key  = key  |>  factor(levels = unique(key)),
    time = time |>  factor(levels = unique(time))
    )

# Plot
hbsc |> 
  ggplot(aes(
    x = time,
    y = value,
    fill = time
  )) +
  geom_col() +
  facet_wrap(~ key) +
  scale_y_continuous(labels  = scales::percent_format(
    scale        = 1,
    big.mark     = ".",
    decimal.mark = ","
  )) +
  theme_statgl() + 
  scale_fill_statgl() +
  theme(legend.position = "none") +
  xlab("time") +
  labs(
    title   = sdg3$figs$fig14$title[language],
    y       = " ",
    x       = " ",
    caption = sdg3$figs$fig14$cap[language]
  )

HBSC survey


# Table
hbsc |> 
  #arrange(desc(time)) %>% 
  mutate(time = time |>  factor(levels = unique(time))) |>  
  spread(time, value) |> 
  rename(" " = 1) |> 
  statgl_table() |> 
  add_footnote(sdg3$figs$fig14$foot[language], notation = "symbol")
2014 2018
Sniffed at least once 6 3
Sniffed at least once in the last 12 months 4 2
Sniffed at least once in the last 30 days 3 2
* Proportion of 11-17 year olds who have sniffed throughout their lives, in the last 12 months and in the last 30 days (N=1.931-2.013).
key1 <- sdg3$figs$fig15$keys$key1[language] |>  unlist()
key2 <- sdg3$figs$fig15$keys$key2[language] |>  unlist()
key3 <- sdg3$figs$fig15$keys$key3[language] |>  unlist()

  
  
# Import 
a <- c(27, 15, 17, 12, 9, 8)
b <- rep(c(2014, 2018), 3)
c <- c(rep(key1, 2), rep(key2, 2), rep(key3, 2))

# Transform
hbsc <-
  data.frame(b, c, a) |>  
  as_tibble() |> 
  rename(
    "time"  = 1,
    "key"   = 2,
    "value" = 3
  ) |> 
  mutate(
    key  = key  |>  factor(levels = unique(key)),
    time = time |>  factor(levels = unique(time))
    )

# Plot
hbsc |> 
  ggplot(aes(
    x    = time,
    y    = value,
    fill = key
  )) +
  geom_col() +
  facet_wrap(~ key) +
  scale_y_continuous(labels  = scales::percent_format(
    scale        = 1,
    big.mark     = ".",
    decimal.mark = ","
  )) +
  theme_statgl() + 
  scale_fill_statgl() +
  theme(legend.position = "none") +
  labs(
    title   = sdg3$figs$fig15$title[language],
    y       = " ",
    x       = " ",
    caption = sdg3$figs$fig15$cap[language]
  )

HBSC survey


# Table
hbsc |> 
  #arrange(desc(time)) %>% 
  mutate(time = time |>  factor(levels = unique(time))) |>  
  spread(time, value) |> 
  rename(" " = 1) |> 
  statgl_table() |> 
  add_footnote(sdg3$figs$fig15$foot[language], notation = "symbol")
2014 2018
Hash at least once 27 15
Hash the last 12 months 17 12
Hash the last 30 days 9 8
* Proportion of 15-17 year olds who reported having tried hash,
had smoked hash in the last 12 months and in the last 30 days (N=329 i 2018).
# Import 
a <- c(92,90,82,56,35,24,89,84,70,52,29,21,80,83,82,82,80,74,98,98,96,84,68,51)
b <- c(rep(2006, 6), rep(2010, 6), rep(2014, 6), rep(2018, 6))
c <- rep(11:16, 4)

# Transform
hbsc <- 
data.frame(b, c, a) |> 
  as_tibble() |> 
  rename(
    time  = 1,
    age   = 2,
    value = 3
  ) |> 
  mutate(
    time = time |> factor(levels = unique(time)),
  )

# Plot
hbsc |> 
  ggplot(aes(
    x = age,
    y = value,
    color = time
  )) +
  geom_line(size = 2) +
  scale_y_continuous(labels  = scales::percent_format(
    scale        = 1,
    big.mark     = ".",
    decimal.mark = ","
  )) +
  theme_statgl() + 
  scale_color_statgl() +
  labs(
    title   = sdg3$figs$fig16$title[language],
    y       = sdg3$figs$fig16$y_lab[language],
    x       = sdg3$figs$fig16$x_lab[language],
    color   = " ",
    caption = sdg3$figs$fig16$cap[language]
  )

HBSC survey


  hbsc |> 
  arrange(desc(time)) |>  
  mutate(time = time |> factor(levels = unique(time))) |> 
  spread(time, value) |> 
  rename("Alder" = 1) |> 
  statgl_table() |>  
  add_footnote(sdg3$figs$fig16$foot[language], notation = "symbol")
Alder 2018 2014 2010 2006
11 98 80 89 92
12 98 83 84 90
13 96 82 70 82
14 84 82 52 56
15 68 80 29 35
16 51 74 21 24
* Development in the proportion who have never been drunk

Physical activity


GS Physical activity
# Import
key1 <- sdg3$figs$fig17$keys$key1[language] |>  unlist()
key2 <- sdg3$figs$fig17$keys$key2[language] |>  unlist()

a <- c(33, 30, 27, 24, 24, 24, 15, 18)
b <- rep(c(2006, 2010, 2014, 2018), 2)
c <- c(rep(key1, 4), rep(key2, 4))

# Transform
hbsc <-
  data.frame(b, c, a) |> 
  as_tibble() |> 
  rename(
    "time"   = 1,
    "gender" = 2,
    "value"  = 3
  ) |> 
  mutate(gender = gender |> factor(levels = unique(gender)))

# Plot
hbsc |> 
  ggplot(aes(
    x     = time,
    y     = value,
    color = gender
  )) +
  geom_line(size = 2) +
  scale_y_continuous(labels  = scales::percent_format(
    scale        = 1,
    big.mark     = ".",
    decimal.mark = ","
  )) +
  theme_statgl() + 
  scale_color_statgl() +
  labs(
    title   = sdg3$figs$fig17$title[language],
    y       = sdg3$figs$fig17$y_lab[language],
    x       = " ",
    color   = " ",
    caption = sdg3$figs$fig17$cap[language]
  )

HBSC survey


# Table
hbsc |> 
  #arrange(desc(time)) %>% 
  mutate(time = time |>  factor(levels = unique(time))) |> 
  spread(time, value) |> 
  rename(" " = 1) |> 
  statgl_table() |> 
  add_footnote(sdg3$figs$fig17$foot[language], notation = "symbol")
2006 2010 2014 2018
Boys 33 30 27 24
Girls 24 24 15 18
* Percent, Moderate physical activity 60 minutes daily by gender, 2006-2018 (N=2,075 in 2018)

Body image


GS Body image
# Import
key1 <- sdg3$figs$fig18$keys$key1[language] |>  unlist()
key2 <- sdg3$figs$fig18$keys$key2[language] |>  unlist()
key3 <- sdg3$figs$fig18$keys$key3[language] |>  unlist()
key4 <- sdg3$figs$fig18$keys$key4[language] |>  unlist()
key5 <- sdg3$figs$fig18$keys$key5[language] |>  unlist()

a <- c(3,3, 11,9,57,58,26,26,3,4)
b <- c(rep(key1, 2), rep(key2, 2), rep(key3, 2), rep(key4, 2), rep(key5, 2))
c <- rep(c(2014, 2018), 5)

# Transform
hbsc <- 
  data.frame(c, b, a) |> 
  as_tibble() |> 
  rename(
    "time"  = 1,
    "key"   = 2,
    "value" = 3
  ) |> 
  mutate(
    time = time |> factor(levels = unique(time)),
    key  = key  |> factor(levels = unique(key))
    )

# Plot
hbsc |> 
  ggplot(aes(
    x = key,
    y = value,
    fill = time
  )) +
  geom_col(position = "dodge2") +
  scale_y_continuous(labels  = scales::percent_format(
    scale        = 1,
    big.mark     = ".",
    decimal.mark = ","
  )) +
  theme_statgl() + 
  scale_fill_statgl() +
  labs(
    title   = sdg3$figs$fig18$title[language],
    y       = " ",
    x       = " ",
    fill    = " ",
    caption = sdg3$figs$fig18$cap[language]
  )

HBSC survey


# Table
hbsc |> 
  arrange(desc(time)) |> 
  mutate(time = time |> factor(levels = unique(time))) |> 
  spread(time, value) |> 
  statgl_table() |> 
  add_footnote(sdg3$figs$fig18$foot[language], notation = "symbol")
key 2018 2014
Too thin 3 3
A little too thin 9 11
Suitable 58 57
A little too fat 26 26
Too fat 4 3
* Percent, Body image satisfaction (N=1,871 in 2018).

Soda


GS Soda
# Import
key1 <- sdg3$figs$fig19$keys$key1[language] |>  unlist()
key2 <- sdg3$figs$fig19$keys$key2[language] |>  unlist()
key3 <- sdg3$figs$fig19$keys$key3[language] |>  unlist()

a <- c(32,22,20,23,14,35,38,34,9,31,44,41,42,13,35)
b <- rep(c(2002,2006,2010,2014,2018), 3)
c <- c(rep(key1, 5), rep(key2, 5), rep(key3, 5))

# Transform
hbsc <- 
data.frame(b, c, a) |> 
  as_tibble() |> 
  rename(
    "time"  = 1,
    "key"   = 2,
    "value" = 3
  ) |> 
  mutate(key = key |> factor(levels = unique(key)))

# Plot
hbsc |> 
  ggplot(aes(
    x     = time,
    y     = value,
    color = key
  )) +
  geom_line(size  = 2) +
  scale_y_continuous(labels  = scales::percent_format(
    scale        = 1,
    big.mark     = ".",
    decimal.mark = ","
  )) +
  theme_statgl() + 
  scale_color_statgl() +
  labs(
    title   = sdg3$figs$fig19$title[language],
    x       = " ",
    y       = " ",
    color   = " ",
    caption = sdg3$figs$fig19$cap[language] 
  )

HBSC survey


# Table
hbsc |> 
  #arrange(desc(time)) %>% 
  mutate(time = time |> factor(levels = unique(time))) |> 
  spread(time, value) |> 
  rename(" " = 1) |> 
  statgl_table() |> 
  add_footnote(sdg3$figs$fig19$foot[language], notation = "symbol")
2002 2006 2010 2014 2018
Nuuk 32 22 20 23 14
Other towns 35 38 34 9 31
Settlements 44 41 42 13 35
* The development in the proportion of students with a daily consumption of soda with sugar, 2002-2018

Toothbrushing


GS Toothbrushing
# Import

key1 <- sdg3$figs$fig20$keys$key1[language] |>  unlist()
key2 <- sdg3$figs$fig20$keys$key2[language] |>  unlist()
key3 <- sdg3$figs$fig20$keys$key3[language] |>  unlist()

a <- c(50,31,19,61,24,16,63,27,10,64,28,8)
b <- rep(c(2006,2010,2014,2018), 3)
c <- rep(c(key1, key2, key3), 4)

# Transform
hbsc <- 
  data.frame(b, c, a) |> 
  as_tibble() |> 
  rename(
    "time"  = 1,
    "key"   = 2,
    "value" = 3
  ) |> 
  mutate(
    key  = key |>  factor(levels = unique(key)),
    time = time |>  factor(levels = unique(time))
  )

# Plot
hbsc |> 
  ggplot(aes(
    x = key,
    y = value,
    fill = key
  )) +
  geom_col() +
  facet_wrap(~ time, nrow = 1) +
  scale_y_continuous(labels  = scales::percent_format(
    scale        = 1,
    big.mark     = ".",
    decimal.mark = ","
  )) +
  theme_statgl() + 
  scale_fill_statgl(guide = guide_legend(nrow = 3)) +
  theme(axis.text.x  = element_blank()) +
  labs(
    title   = sdg3$figs$fig20$title[language],
    y       = " ",
    x       = " ",
    fill    = " ",
    caption = sdg3$figs$fig20$cap[language]
  )

HBSC survey


# Table
hbsc |> 
  #arrange(desc(time)) %>% 
  mutate(time = time |>  factor(levels = unique(time))) |>  
  spread(time, value) |> 
  rename(" " = 1) |> 
  statgl_table() |> 
  add_footnote()
2006 2010 2014 2018
More than once a week 50 64 63 61
Once a day 24 31 28 27
Less often than daily 10 16 19 8

Telephone counseling


GS Telephone counseling
# Import
key1 <- sdg3$figs$fig21$keys$key1[language] |>  unlist()
key2 <- sdg3$figs$fig21$keys$key2[language] |>  unlist()
key3 <- sdg3$figs$fig21$keys$key3[language] |>  unlist()
key4 <- sdg3$figs$fig21$keys$key4[language] |>  unlist()

a <- c(1732, 272, 547,  1485, 1887, 382, 668, 1609, 636, 106, 182, 560)
b <- c(rep(2019, 4), rep(2020, 4), rep(2021, 4))
c <- rep(c(key1, key2, key3, key4), 3)

# Transform
tusaannga <- 
  data.frame(b, c, a) |> 
  as_tibble() |> 
  rename(
    "time"  = 1,
    "key"   = 2,
    "value" = 3
  ) |> 
  mutate(key = key |>  factor(levels = unique(key)))

tusaannga |> 
  filter(!key %in% c(key1, key2)) |>  
  ggplot(aes(
    x = time,
    y = value,
    fill = key
  )) +
  geom_col() +
  theme_statgl() + 
  scale_fill_statgl(reverse = TRUE) +
  labs(
    title    = sdg3$figs$fig21$title[language],
    subtitle = sdg3$figs$fig21$sub[language],
    x        = " ",
    y        = sdg3$figs$fig21$y_lab[language],
    fill     = " ",
    caption  = sdg3$figs$fig21$cap[language]
  )


# Table
tusaannga |> 
  #arrange(desc(time)) %>% 
  mutate(time = time |>  factor(levels = unique(time))) |>  
  spread(1, 3) |> 
  rename(" " = 1) |> 
  statgl_table() |> 
  add_footnote(sdg3$figs$fig21$foot[language], notation = "symbol")
2019 2020 2021
Adult 1.732 1.887 636
Child 272 382 106
SMS 547 668 182
Call 1.485 1.609 560
* Data for 2021 includes 6 January - 23 April

Family care


GS Family care
# Import
SOXPV003_raw <- 
  statgl_url("SOXPV003", lang = language) |> 
  statgl_fetch(
    "first adress in greenland" = px_all(),
    year                        = px_top(3),
    .col_code                    = TRUE
  ) |> 
  as_tibble()

# Transform
SOXPV003 <- 
  SOXPV003_raw |> 
  filter(`first adress in greenland` != SOXPV003_raw[[1]][1]) |> 
  mutate(
    year                        = year |>  as.numeric(),
    `first adress in greenland` = `first adress in greenland` |>  fct_reorder(value, sum)
    )

# Plot
SOXPV003 |> 
  ggplot(aes(
    x = `first adress in greenland`,
    y = value,
    fill = year
  )) +
  geom_col() +
  coord_flip() +
  theme_statgl() + 
  scale_color_statgl() +
  theme(legend.position = "none") +
  facet_wrap(~ year) +
  labs(
    title   = statgl_meta(statgl_url("SOXPV003", lang = language))[1],
    x       = statgl_meta(statgl_url("SOXPV003", lang = language))[2]$variables[[1]]$text |>  str_to_title(),
    y       = sdg3$figs$fig22$y_lab[language],
    caption = sdg3$figs$fig22$cap[language]
  )

StatBank


# Table
x_lab        <- 1
names(x_lab) <- statgl_meta(statgl_url("SOXPV003", lang = language))[2]$variables[[1]]$text |>  str_to_title()

tab <- 
  SOXPV003 |> 
  mutate(
    `first adress in greenland` = `first adress in greenland` |>  fct_rev(),
    year = year |>  factor(levels = unique(year)) |>  fct_rev()
    ) |> 
  spread(2, 3)

tab |> 
  rename(x_lab) |> 
  statgl_table() |> 
  add_footnote(sdg3$figs$fig22$foot[language], notation = "symbol")
First Adress In Greenland 2023 2022 2021
Tasiilaq 81 73 65
Nuuk 47 53 61
Ilulissat 37 36 39
Sisimiut 32 35 40
Qaqortoq 40 31 31
Maniitsoq 36 25 24
Nanortalik 31 25 24
Aasiaat 17 20 17
Paamiut 11 19 18
Narsaq 18 14 13
Qasigiannguit 12 12 16
Upernavik 13 12 13
Qaanaaq 9 14 13
Kangaatsiaq 9 12 10
Qeqertarsuaq 11 12 6
Uummannaq 5 5 5
Ittoqqortoormiit NA 2 3
* Number of children
# Import
SOXPV001_raw <- 
  statgl_url("SOXPV001", lang = language) |> 
  statgl_fetch(
    unit               = c("Aarsvaerk"),
    "age of the child" = 0:19,
    year               = px_top(3),
    .col_code          = TRUE
    ) |> 
  as_tibble()

# Transform
SOXPV001 <- 
  SOXPV001_raw |> 
  mutate(
    year = year |>  as.numeric(),
    `age of the child` = `age of the child` |>  factor(levels = unique(`age of the child`))
    )

# Plot
SOXPV001 |> 
  ggplot(aes(
    x = `age of the child`,
    y = value,
    fill = year
  )) +
  geom_col() +
  facet_wrap(~ year) +
  coord_flip() +
  theme_statgl() + 
  scale_color_statgl() +
  theme(legend.position = "none") +
  labs(
    title    = statgl_meta(statgl_url("SOXPV001", lang = language))[1],
    subtitle = str_to_sentence(SOXPV001_raw[[1]][1]),
    x        =  str_to_sentence(statgl_meta(statgl_url("SOXPV001", lang = language))[2]$variables[[2]]$text),
    y        = sdg3$figs$fig23$y_lab[language],
    caption  = sdg3$figs$fig23$cap[language]
  )

StatBank


# Table
age_lab        <- 1
names(age_lab) <- str_to_sentence(statgl_meta(statgl_url("SOXPV001", lang = language))[2]$variables[[2]]$text)

foot <- 

tab <- 
  SOXPV001 |> 
  mutate(year = year |>  factor(levels = unique(year)) |>  fct_rev()) |>  
  spread(3, 4)

tab |> 
  select(-1) |>  
  rename(age_lab) |>  
  statgl_table() |> 
  add_footnote(paste0(sdg3$figs$fig23$foot[language], SOXPV001_raw[[1]][1]), notation = "symbol")
Age of the child 2023 2022 2021
0 1,5 1,5 2,8
1 9,7 9,2 15,3
2 13,4 19,3 18,8
3 20,8 22,6 21,3
4 25,8 24,5 24,4
5 27,3 27,8 22,9
6 25,9 25,2 20,2
7 28,5 22,4 12,1
8 23,3 14,4 24,3
9 15,3 23,5 20,7
10 25,0 24,2 28,1
11 28,6 24,9 19,3
12 28,1 19,5 24,8
13 22,5 25,7 23,5
14 23,0 17,1 26,4
15 19,0 22,0 15,3
16 15,3 11,8 17,3
17 9,7 20,5 22,3
18 19,0 17,2 22,1
19+ 23,8 24,3 14,7
* Number of children, converted to full year

diagnoses


GS diagnoses
diag_cat <- 
  c(
    'F00: Uspec. fysisk handicap',
    'F01: Synstab',
    'F02: Høretab',
    'F03: Epilepsi',
    'F04: Stofskifte',
    'F05: Andre progressive lidelser',
    'F06: Gigt',
    'F07: Genetiske & medfødte',
    'F08: Indre organer',
    'F09: Hudlidelse,vansiring',
    'F10: Åndedræt',
    'F11: Kredsløb',
    'F12: Bevægeapparat',
    'F13: Hjerneskade',
    'F14: Immunforsvar',
    'F15: Andre handicaps',
    'F16: Talehandicap',
    'P00: Uspec. psykisk handicap',
    'P01: Mental retardering',
    'P02: Organiske psykiske lidelser',
    'P03: Misbrug',
    'P04: Udviklingsforstyrrelse',
    'P05: Personlighedsforstyrrelse',
    'P06: Psykotiske lidelser',
    'P07: Andre psykiske lidelser'
  )

SOXFO11_raw <- 
  statgl_url("SOXFO11", lang = language) |> 
  statgl_fetch(
    time                 = px_all(),
    "diagnosis Category" = diag_cat,
    .col_code            = TRUE
  ) |> 
  as_tibble()


if (language == "da") {
  
  f <- "Fysisk handicap"
  p <- "Psykisk handicap"
  
} else if (language == "kl") {

  f <- "Timikkut innarluuteqarneq"
  p <- "Tarnikkut innarluuteqarneq"
  
} else {

  f <- "Physical disability"
  p <- "Mental disability"
  
}

vec        <- c("F", "P")
names(vec) <- c(f, p)

SOXFO11 <- 
  SOXFO11_raw |> 
  separate(`diagnosis Category`, into = c("type", "cat")) |> 
  select(-cat) |> 
  mutate(type = type |>  str_remove_all("[:digit:]")) |> 
  group_by(type, time) |> 
  summarise(value = sum(value, na.rm = TRUE)) |> 
  ungroup() |> 
  spread(type, value) |> 
  rename(vec) |> 
  gather(key, value, -time) |> 
  mutate(key = key |>  fct_reorder(value, .fun = sum, .desc = FALSE))

SOXFO11 |> 
  ggplot(aes(
    x    = time, 
    y    = value,
    fill = key
  )) +
  geom_col() +
  theme_statgl() + 
  scale_fill_statgl() +
  labs(
    title    = sdg3$figs$fig24$title[language],
    subtitle = sdg3$figs$fig24$sub[language],
    y        = " ",
    x        = " ",
    fill     = " ",
    caption  = sdg3$figs$fig24$cap[language]
  )

StatBank


SOXFO11 |> 
  mutate(
    time = time |>  fct_rev(),
    key = key |>  fct_reorder(value, sum) |>  fct_rev()
    ) |> 
  spread(time, value) |> 
  rename(" " = 1) |> 
  statgl_table() |> 
  kableExtra:: add_footnote(sdg3$figs$fig24$foot[language], notation = "symbol")
2018
Mental disability 825
Physical disability 561
* Number of persons

Incidence of sexually transmitted diseases

FN 3.7.1 Incidence of sexually transmitted diseases among 15-24-year-old, by type and sex
url <- paste0("https://bank.stat.gl:443/api/v1/", language, "/Greenland/SU/SU01/SU0120/SUXLSKS1.px")

# Import
SUXLSKS1_raw <- 
  url |>
  statgl_fetch(
    age       = 15:24,
    disease   = 1:3,
    sex       = px_all(),
    time      = px_top(5),
    .col_code = T
  ) |> 
  as_tibble()

# Transform

SUXLSKS1 <- 
  SUXLSKS1_raw |> 
  group_by(disease, sex, time) |> 
  summarise(value = sum(value)) |> 
  ungroup() |> 
  arrange(disease, time) |> 
  unite(combi, disease, sex, sep = " ") |> 
  mutate(combi = fct_inorder(combi))

# Plot
SUXLSKS1 |> 
  ggplot() +
    geom_col(aes(
      x     = time,
      y     = value,
      fill  = combi
     ),
     position = "dodge"
    ) +
  scale_fill_statgl(guide = guide_legend(ncol = 3)) +
  theme_statgl() +
  labs(
    title    = sdg3$figs$fig25$title[language],
    subtitle = sdg3$figs$fig25$sub[language],
    x       = " ",
    y       = " ",
    fill    = " ",
    caption = sdg3$figs$fig25$cap[language]
  )

StatBank


tabel <- 
  SUXLSKS1_raw |> 
  filter(time >= year(Sys.time()) - 7) |> 
  group_by(disease, sex, time) |> 
  summarise(value = sum(value)) |> 
  ungroup() |> 
  arrange(sex) |>  
  mutate(vec = sex) |> 
  unite(combi, disease, sex, sep = " ") |> 
  mutate(combi = fct_inorder(combi)) |> 
  spread(time, value)
  

tabel |> 
  rename(" " = 1) |> 
  select(-vec) |> 
  statgl_table() |> 
  pack_rows(index = table(tabel[[2]])) |> 
  add_footnote(sdg3$figs$fig25$foot[language], notation = "symbol")
2018 2019 2020 2021 2022
Men
Chlamydia Men 606 548 557 543 524
Gonorrhea Men 240 322 334 413 499
Syphilis Men NA NA NA NA NA
Total
Chlamydia Total 1.862 1.681 1.651 1.638 1.575
Gonorrhea Total 581 886 1.002 1.101 1.270
Syphilis Total 62 48 66 NA NA
Women
Chlamydia Women 1.256 1.133 1.094 1.095 1.051
Gonorrhea Women 341 564 668 688 771
Syphilis Women 42 30 45 NA NA
* Number of persons